home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
vbkontrol.exe
/
FSSOCK11.ZIP
/
demo
/
fstest
/
CLIENT.FRM
next >
Wrap
Text File
|
1995-07-15
|
11KB
|
406 lines
VERSION 2.00
Begin Form client
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "Client Test"
ClientHeight = 6240
ClientLeft = 690
ClientTop = 1605
ClientWidth = 6960
Height = 6645
Icon = CLIENT.FRX:0000
KeyPreview = -1 'True
Left = 630
LinkTopic = "Form1"
ScaleHeight = 6240
ScaleWidth = 6960
Top = 1260
Width = 7080
Begin TextBox localport
Height = 285
Left = 120
TabIndex = 22
Top = 4920
Width = 2175
End
Begin TextBox localaddress
Height = 285
Left = 120
TabIndex = 21
Top = 4320
Width = 2175
End
Begin FSSocket FSSocket1
Connect = 0 'False
EOL = ""
HostAddress = "127.0.0.1"
HostName = "localhost"
InputBufferSize = 4096
Left = 1800
Listen = 0 'False
ListenPort = 0
OutputBufferSize= 4096
PortNumber = 0
Protocol = 0 'TCP
ServiceName = ""
Top = 1080
End
Begin CommandButton Command4
Caption = "Set"
Height = 255
Left = 1800
TabIndex = 6
Top = 2520
Width = 495
End
Begin CommandButton Command3
Caption = "Set"
Height = 255
Left = 1800
TabIndex = 4
Top = 1920
Width = 495
End
Begin CommandButton Command2
Caption = "Disconnect"
Enabled = 0 'False
Height = 375
Left = 1080
TabIndex = 10
Top = 5760
Width = 1215
End
Begin TextBox SVSNAM
Height = 285
Left = 120
TabIndex = 8
Top = 3720
Width = 2175
End
Begin TextBox PORTNUM
Height = 285
Left = 120
TabIndex = 7
Top = 3120
Width = 2175
End
Begin TextBox HSTADDR
Height = 285
Left = 120
TabIndex = 5
Top = 2520
Width = 1575
End
Begin OptionButton TCP
BackColor = &H00C0C0C0&
Caption = "TCP"
Height = 255
Left = 120
TabIndex = 1
Top = 960
Value = -1 'True
Width = 1095
End
Begin OptionButton UDP
BackColor = &H00C0C0C0&
Caption = "UDP"
Height = 255
Left = 120
TabIndex = 2
Top = 1320
Width = 1095
End
Begin TextBox HSTNAM
Height = 285
Left = 120
TabIndex = 3
Top = 1920
Width = 1575
End
Begin CheckBox RDYTOSND
BackColor = &H00C0C0C0&
Caption = "Ready to Send"
Height = 255
Left = 120
TabIndex = 14
TabStop = 0 'False
Top = 120
Width = 1695
End
Begin CheckBox CNTD
BackColor = &H00C0C0C0&
Caption = "Connected"
Height = 255
Left = 120
TabIndex = 13
TabStop = 0 'False
Top = 480
Width = 1455
End
Begin CommandButton Command1
Caption = "Connect"
Height = 375
Left = 1080
TabIndex = 9
Top = 5400
Width = 1215
End
Begin TextBox OUTDATA
Height = 285
Left = 3120
TabIndex = 0
Text = "Text2"
Top = 5880
Width = 3735
End
Begin TextBox INDATA
Height = 5775
Left = 2400
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 11
TabStop = 0 'False
Text = "Text1"
Top = 0
Width = 4575
End
Begin Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Local Port"
Height = 195
Left = 120
TabIndex = 20
Top = 4680
Width = 885
End
Begin Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Local Address"
Height = 195
Left = 120
TabIndex = 19
Top = 4080
Width = 1215
End
Begin Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Service"
Height = 195
Left = 120
TabIndex = 18
Top = 3480
Width = 660
End
Begin Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Port"
Height = 195
Left = 120
TabIndex = 17
Top = 2880
Width = 360
End
Begin Line Line2
X1 = 2400
X2 = 2400
Y1 = 0
Y2 = 6240
End
Begin Line Line1
X1 = 0
X2 = 2400
Y1 = 840
Y2 = 840
End
Begin Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "HostAddress"
Height = 195
Left = 120
TabIndex = 16
Top = 2280
Width = 1080
End
Begin Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "HostName"
Height = 195
Left = 120
TabIndex = 15
Top = 1680
Width = 885
End
Begin Label Label1
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Input:"
Height = 255
Left = 2520
TabIndex = 12
Top = 5880
Width = 510
End
End
Dim lastchanged As Integer
Sub Command1_Click ()
FSSocket1.EOL = Chr$(10)
On Error GoTo errx
FSSocket1.Connect = True
LocalAddress.Text = FSSocket1.LocalAddress
LocalPort.Text = FSSocket1.LocalPort
If FSSocket1.Protocol = 1 Then
command2.Enabled = True
command1.Enabled = False
End If
Exit Sub
errx:
MsgBox FSSocket1.WSALastErrorMsg
Resume Next
End Sub
Sub Command2_Click ()
FSSocket1.Connect = False
LocalAddress.Text = ""
LocalPort.Text = ""
End Sub
Sub Command3_Click ()
On Error Resume Next
FSSocket1.HostName = HSTNAM.Text
HSTADDR.Text = FSSocket1.HostAddress
End Sub
Sub Command4_Click ()
On Error Resume Next
FSSocket1.HostAddress = HSTADDR.Text
HSTNAM.Text = FSSocket1.HostName
End Sub
Sub Form_Load ()
FSSocket1.EOL = Chr$(10)
INDATA.Text = ""
OUTDATA.Text = ""
HSTNAM.Text = FSSocket1.HostName
HSTADDR.Text = FSSocket1.HostAddress
PORTNUM.Text = FSSocket1.PortNumber
SVSNAM.Text = FSSocket1.ServiceName
If FSSocket1.Protocol = 0 Then
TCP.Value = True
Else
UDP.Value = True
End If
Load server
lastchanged = 0
End Sub
Sub Form_Unload (Cancel As Integer)
Unload server
End Sub
Sub FSSocket1_Connected (StatusCode As Integer, description As String)
CNTD.Value = 1
RDYTOSND.Value = 1
command1.Enabled = False
command2.Enabled = True
LocalAddress.Text = FSSocket1.LocalAddress
LocalPort.Text = FSSocket1.LocalPort
End Sub
Sub FSSocket1_DataReceived (Text As String, EOL As Integer)
INDATA.SelStart = 32000
INDATA.SelText = Text
If EOL Then
INDATA.SelStart = 32000
INDATA.SelText = Chr$(13) & Chr$(10)
End If
End Sub
Sub FSSocket1_Disconnected (StatusCode As Integer, description As String)
CNTD.Value = 0
RDYTOSND.Value = 0
command1.Enabled = True
command2.Enabled = False
LocalAddress.Text = ""
LocalPort.Text = ""
End Sub
Sub FSSocket1_ReadyToSend ()
RDYTOSND.Value = 1
End Sub
Sub HSTADDR_KeyPress (keyascii As Integer)
On Error Resume Next
If keyascii = 13 Then
FSSocket1.HostAddress = HSTADDR.Text
HSTNAM.Text = FSSocket1.HostName
keyascii = 0
End If
End Sub
Sub HSTNAM_KeyPress (keyascii As Integer)
On Error Resume Next
If keyascii = 13 Then
FSSocket1.HostName = HSTNAM.Text
HSTADDR.Text = FSSocket1.HostAddress
keyascii = 0
End If
End Sub
Sub OUTDATA_KeyPress (keyascii As Integer)
If keyascii = 13 Then
If FSSocket1.Connect = True Then
RDYTOSND.Value = 0
FSSocket1.Send = OUTDATA.Text & Chr$(10)
End If
OUTDATA.Text = ""
keyascii = 0
End If
End Sub
Sub PORTNUM_Change ()
On Error Resume Next
FSSocket1.PortNumber = PORTNUM.Text
SVSNAM.Text = FSSocket1.ServiceName
End Sub
Sub SVSNAM_Change ()
On Error Resume Next
FSSocket1.ServiceName = SVSNAM.Text
PORTNUM.Text = FSSocket1.PortNumber
End Sub
Sub TCP_Click ()
FSSocket1.Protocol = 0
End Sub
Sub UDP_Click ()
FSSocket1.Protocol = 1
End Sub